package com.skycity.auth;

import cn.hutool.core.codec.Base64;
import org.springframework.security.crypto.encrypt.BytesEncryptor;
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;

/**
 * @Description
 * @Author YingBo.Dai
 * @Date 2024/11/8
 * @Version 1.0
 */
public class Encypt {
    public static void main(String[] args) {
        BytesEncryptor encryptor = new RsaSecretEncryptor();
        byte[] encrypt = encryptor.encrypt("adfasdf".getBytes());
        String encode = Base64.encode(encrypt);
        System.out.println(encode);
        byte[] decrypt = encryptor.decrypt(encrypt);
        System.out.println(new String(decrypt));

        System.out.println(KeyGenerators.string().generateKey());

    }
}
